﻿@model EyeOpen.Web.Mvc.Models.CustomerListModel
@{
	const string UpdateTargetId = "async";

	var options = 
		new AjaxOptions
			{
				HttpMethod = "Post",
				UpdateTargetId = UpdateTargetId,
				InsertionMode = InsertionMode.Replace
			};
}        
 
<div id="customerList">
	@using (Ajax.BeginForm(options))
	{
		<fieldset>
			<legend>Customer list</legend>
			<div>
				@Ajax.ActionLink("Create", "Create", "Customer", options)
				<br />
				<br />
				@foreach (var customer in Model.CustomerList)
				{
					<div class="operation">
						@Ajax.ActionLink("Edit", "Edit", "Customer", new { id = @customer.Id }, options)  
					
						@Ajax.ActionLink("Delete", "Delete", "Customer", new { id = @customer.Id }, options.Change(x => x.Confirm = "Are you sure to delete?"))
						<span class="column">@customer.Name</span>
					</div>
				}
			</div>
		</fieldset>
	 }
</div>
<div id="@UpdateTargetId"></div>